for i in range(10):
   for j in range(1,i+1):
       print("{}*{}={:<2}".format(j, i, i * j), end=" ")
   print("")
print("")
for i in range(9,0,-1):
   for j in range(1,i+1):
       print("{}*{}={:<2}".format(j, i, i * j), end=" ")
   print("")

for i in range(1,10):
   for k in range(9-i):
        print(end="       ")
   for j in range(i, 0, -1):
        print("{}*{}={:<2}".format(i, j, i * j), end=" ")
   print("")
print("")
for i in range(9,0,-1):
   for k in range(9-i):
       print(end="       ")
   for j in range(i,0,-1):
       print("{}*{}={:<2}".format(j,i,i*j),end=" ")
   print("")

print("="*50)


i=1
while i<=9:
    j=1
    while j<=i:
        print("{}*{}={:<2}".format(j, i, i * j), end=" ")
        j+=1
    print("")
    i+=1
print("")
i=9
while i>=1:
    j=1
    while i>=j:
         print("{}*{}={:<2}".format(j,i,i*j),end=" ")
         j+=1
    print("")
    i-=1


i=1
while i<=9:
    k=1
    while k<10-i:
        print(end="       ")
        k+=1
    j=i
    while j>=1:
        print("{}*{}={:<2}".format(j, i, i * j), end=" ")
        j-=1
    print("")
    i+=1
print("")
i=9
while i>=1:
    k = 1
    while k < 10 - i:
        print(end="       ")
        k += 1
    j=i
    while j>=1:
         print("{}*{}={:<2}".format(j,i,i*j),end=" ")
         j-=1
    print("")
    i-=1